package com.wc.alorithm_blue_bridge._前缀和与差分.Q3400;

import java.io.*;

/**
 * @Author congege
 * @Description 异或森林
 * https://www.lanqiao.cn/problems/3400/learning/?page=1&first_category_id=1
 * @Date Created in 2023/11/25-21:44
 */
public class Main {
    public static void main(String[] args) {
        Input sc = new Input();
        int n = sc.nextInt();
        int[] array = new int[n + 1];
        int[] pre = new int[n + 1];
        // 前缀和
        for (int i = 1; i <= n; i++) {
            array[i] = sc.nextInt();
            pre[i] = array[i] ^ pre[i - 1];
        }
        int cnt = 0;
        for (int l = 1; l <= n; l++) {
            for (int r = l; r <= n; r++) {
                int sub = pre[r] ^ pre[l - 1];
                if (!isSq(sub)) {
                    cnt++;
                }
            }
        }
        System.out.println(cnt);
    }

    static class Input {
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public int nextInt() {
            try {
                in.nextToken();
            } catch (Exception e) {
                return -1;
            }
            return (int) in.nval;
        }
    }

    /**
     * 是否为平方数
     *
     * @param val
     * @return
     */
    public static boolean isSq(int val) {
        int mid = (int) Math.sqrt(val);
        return mid * mid == val;
    }
}
